#include <stdio.h>
#include <getch.h>
#include <stdlib.h>
#include "main.h"
#include "master.h"
#include "teacher.h"
#include "student.h"

int main(int argc,const char* argb[])
{
	FILE *fp;
	fp=fopen("1.txt","r");
	fread(master_password,sizeof(master_password),1,fp);
	fread(ste,sizeof(ste),1,fp);
	fread(stb,sizeof(stb),1,fp);
	fread(stu,sizeof(stu),1,fp);
	fread(str,sizeof(str),1,fp);
	fclose(fp);
	for(;;)
	{
		system("clear");
		printf("-----------------------------\n");
		printf("   欢迎使用学生管理系统！\n");
		printf("-----------------------------\n");	
		printf("     1、校长系统\n");
		printf("-----------------------------\n");
		printf("     2、教师系统\n");
		printf("-----------------------------\n");
		printf("     3、学生系统\n");
		printf("-----------------------------\n");
		printf("     0、退出系统\n");
		printf("-----------------------------\n");
		switch(getch())
		{
			case '1':master();break;
			case '2':teacher();break;
			case '3':sTudent();break;
			case '0':
				fp=fopen("1.txt","w");
				fwrite(master_password,sizeof(master_password),1,fp);
				fwrite(ste,sizeof(ste),1,fp);
				fwrite(stb,sizeof(stb),1,fp);
				fwrite(stu,sizeof(stu),1,fp);
				fwrite(str,sizeof(str),1,fp);
				fclose(fp);
			return 0;
		}
	}
}
